<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class InitOrchid extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'orchid:init';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '初始化兰草项目';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        echo '准备启动orchid service...' . PHP_EOL;
        system('composer install');
        system('cd resources/views/admin && npm install');
        system('cd resources/views/admin && npm run build:prod');
        system('cp -r resources/views/admin/dist/static/ public/static/');
    }
}
